//
//  ZClubSettingCell.m
//  WeClubs
//
//  Created by Zed Link on 27/4/2017.
//  Copyright © 2017 Zed. All rights reserved.
//

#import "ZClubSettingCell.h"
#import <UIImageView+WebCache.h>
#import "MDPieView.h"
@interface ZClubSettingCell ()

@property (weak, nonatomic) IBOutlet UIView *cardView;
@property (weak, nonatomic) IBOutlet UIImageView *logoImgView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *clubTypeLabel;

@property (weak, nonatomic) IBOutlet MDPieView *pieView;
@property(nonatomic)MDPieView *pView;
@end

@implementation ZClubSettingCell

- (void)awakeFromNib{

    [super awakeFromNib];
    

}
- (void)zSetupCell
{
    [super zSetupCell];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [self.cardView zShadowAndCornerDeal:16];
    [self.logoImgView zCornerDeal:22];
    [self.clubTypeLabel zCornerDeal:8];
    
    _pView =  [[MDPieView alloc]initWithFrame:CGRectMake(Z_SCREEN_WIDTH -36 * 2, (self.cardView.height - 36)/2, 36, 36) andPercent:0.1 andColor:[UIColor colorWithRed:0.31f green:0.79f blue:0.98f alpha:1.00f]];
    
    [self.contentView addSubview:_pView];
}
- (void)updateCellContent
{
//    if (self.model.avatar_url != nil) {
        [self.logoImgView sd_setImageWithURL:[NSURL URLWithString:self.model.avatar_url]];
//    }
    
    [self.titleLabel setText:self.model.clubName];
   [_pView reloadViewWithPercent:_model.finishCount];
    
}

#pragma mark - Getter & Setter

- (void)setModel:(ZOwnerClubModel *)model
{
    _model = model;
    
    
    

    [self updateCellContent];
}

@end
